<!-- 总括 -->
<template>
	<view class="summarize">
		<!-- 饼图 -->
		<view class="morezx ledai">
			<view class="firstEchartBox">
				<ringEcharts :seriesData="seriesData7" :titles="type==2?'':code" :subtitles="type==2?'':names"></ringEcharts>
			</view>
			<view class="firstTableBox" v-if="type == 3">
				<wyb-table :headers="schoolHeader" :url-col="urlCol"  :contents="schooleTableData" link-color="#FDE080"  width="100%" />
			</view>
			
		</view>
		
		<!-- 平均报录比情况 -->
		<view class="morezx ledai">
			<!-- <view class="bltitle">平均报录比情况</view> -->
			<view class="little_words">
				<image class="little_words_icon" src="https://image.alhelp.net/uploads/20231104/42112fa0ed7e9c879d6965a7badf2bae.png"></image>
				平均报录比情况
			</view>
			<view class="rightInfoBox">
				<view class="firstTop">
					<image src="https://aihelp.oss-cn-hangzhou.aliyuncs.com/wechat/see.png" alt=""
						style="width: 40px; height: 40px;margin-left: 10px;" />
					<view class="firstTopWords">学校是否保护一志愿？</view>
				</view>
				<view class="lineBox"></view>
				<view class="middleBox">
					<span class="smallSize">复录比大于1.2:1，还接收调剂的</span>
					<div class="weightFont">——不保护一志愿</div>
				</view>
				<view class="middleBox">
					<span class="smallSize">接收调剂生：一志愿录取最低分>国家线20年~30分</span>
					<div class="weightFont">——不保护一志愿</div>
				</view>
				<view class="middleBox">
					<span class="smallSize">有调剂进来，又有调剂出去的</span>
					<div class="weightFont">——可能不保护一志愿</div>
				</view>
			</view>
			
			<view class="firstEchartBox">
				<groupEcharts ref="groupEcharts1" :categories="categories1" :seriesData="seriesData1"></groupEcharts>
			</view>
			<view class="firstTableBox">
				<v-tabs v-model="averactiveName1" :tabs="tabs1" @change="averhandleClick1" activeColor="#333" lineColor="#0BB976"></v-tabs>
				<view class="tabBox"></view>
				<!-- {{firstTableData1[0].category}} -->
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers" :contents="firstTableData1" width="100%" />
				<!-- {{firstTableData2[0].category}} -->
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers" :contents="firstTableData2" width="100%" />
				<!-- {{firstTableData3[0].category}} -->
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers" :contents="firstTableData3" width="100%" />
				<!-- {{firstTableData4[0].category}} -->
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers" :contents="firstTableData4" width="100%" />
				<!-- {{firstTableData5[0].category}} -->
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers" :contents="firstTableData5" width="100%" />
			</view>
		</view>
	
		
		<!-- 初试成绩（以第一志愿口径统计） -->
		<view class="morezx ledai">
			<view class="little_words">
				<image class="little_words_icon" src="https://image.alhelp.net/uploads/20231104/42112fa0ed7e9c879d6965a7badf2bae.png"></image>
				初试成绩（以第一志愿口径统计）
			</view>
			<view class="firstEchartBox">
				<barEcharts :categories="categories2" :seriesData="seriesData2"></barEcharts>
			</view>
			<view class="firstEchartBox">
				<lineEcharts :categories="categories3" :seriesData="seriesData3"></lineEcharts>
			</view>
			<view class="firstTableBox">
				<v-tabs v-model="averactiveName2" :tabs="tabs2" @change="averhandleClick2" activeColor="#333" lineColor="#0BB976"></v-tabs>
				<view class="tabBox"></view>
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers1" :contents="getCountaverCountdetaiLefttableData" width="100%" />
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers11" :contents="getCountaverCountdetaiLefttableData1" width="100%" />
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers12" :contents="getCountaverCountdetaiLefttableData2" width="100%" />
			</view>
		</view>
		
		<!-- 初试成绩（以调剂口径统计） -->
		<view class="morezx ledai">
			<view class="little_words">
				<image class="little_words_icon" src="https://image.alhelp.net/uploads/20231104/42112fa0ed7e9c879d6965a7badf2bae.png"></image>
				初试成绩（以调剂口径统计）
			</view>
			<view class="firstEchartBox">
				<barEcharts :categories="categories4" :seriesData="seriesData4"></barEcharts>
			</view>
			<view class="firstEchartBox">
				<lineEcharts :categories="categories5" :seriesData="seriesData5"></lineEcharts>
			</view>
			<view class="firstTableBox">
				<v-tabs v-model="averactiveName3" :tabs="tabs2" @change="averhandleClick3" activeColor="#333" lineColor="#0BB976"></v-tabs>
				<view class="tabBox"></view>
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers1" :contents="getCountaverCountdetaiLefttableData3" width="100%" />
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers11" :contents="getCountaverCountdetaiLefttableData4" width="100%" />
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers12" :contents="getCountaverCountdetaiLefttableData5" width="100%" />
			</view>
		</view>
		<!-- 初试分数线 -->
		<view class="morezx ledai">
			<view class="little_words">
				<image class="little_words_icon" src="https://image.alhelp.net/uploads/20231104/42112fa0ed7e9c879d6965a7badf2bae.png"></image>
				初试分数线
			</view>
			<view class="firstEchartBox">
				<lineEcharts :categories="categories6" :seriesData="seriesData6"></lineEcharts>
			</view>
			<view class="firstTableBox">
				<v-tabs v-model="averactiveName4" :tabs="tabs3" @change="averhandleClick4" activeColor="#333" lineColor="#0BB976"></v-tabs>
				<view class="tabBox"></view>
				<wyb-table ref="table" height="300px" :first-line-fixed="true" :headers="headers2" :contents="averCountdetaiLefttableData" width="100%" />
			
			</view>
		</view>
	</view>
</template>

<script>
	import wybTable from '@/pages/toolbox/components/wyb-table/wyb-table.vue'
	import vTabs from '@/pages/toolbox/components/v-tabs/components/v-tabs/v-tabs.vue'; 
	import { getScoreMajorYears,listSchoolTypeApplyAndEnrollRate,pageSchoolAreaApplyAndEnrollRate,subjectStat,listSchoolFirstTotalScoreRateTableData,getScoreSection,getMajorCounts } from "@/api/toolbox.js"
	import groupEcharts from '@/pages/toolbox/components/qiun-echarts/group.vue';
	import barEcharts from '@/pages/toolbox/components/qiun-echarts/bar.vue';
	import lineEcharts from '@/pages/toolbox/components/qiun-echarts/line.vue';
	import pieEcharts from '@/pages/toolbox/components/qiun-echarts/pie.vue';
	import ringEcharts from '@/pages/toolbox/components/qiun-echarts/ring.vue';
	export default {
		components: {
			groupEcharts,
			barEcharts,
			lineEcharts,
			pieEcharts,
			ringEcharts,
			wybTable,
			vTabs
		},
		data() {
			return {
				yearValue: '',
				type: 1, //1、学科，2、一级学科，3、专业
				code : '',//code码。当type为1时，code为学科code码，当type为2时，code为一级学科code码，当type为3时，code为专业code码
				names: '',
				yearOptionsTableInfo: [],
				yearOptions: [],
				seriesData7: [],
				urlCol: [{
					type: 'route',
					key: 'schoolNumNs'
				}, {
					type: 'route',
					key: 'schoolNumNs1'
				}, {
					type: 'route',
					key: 'schoolNumNs2'
				}],
				schoolHeader: [],
				schooleTableData: [],
				
				// 报录比
				categories1: ["欲招数", "录取数", "保研数", "调剂数", '第一志愿'],
				// ategories1: ["欲招数", "录取数(含专项计划和定向)", "推免数", "调剂数"],
				seriesData1:  [],
				averactiveName1: 0,
				tabs1: ["大学类型", "省份"],
				headers: [],
				firstTableData1: [],
				firstTableData2: [],
				firstTableData3: [],
				firstTableData4: [],
				firstTableData5: [],
				
				// 初试成绩
				categories2: [],
				seriesData2: [],
				categories3: [],
				seriesData3: [],
				averactiveName2: 0,
				averactiveName3: 0,
				tabs2: ['初试总分','英语','政治','专一','专二'],
			
				headers1: [
					{label: '年份',key: 'Type'},
					{label: '分区',key: 'AType1'},
					{label: '2023',key: 'AFirstYear'},
					{label: '2022',key: 'ASecondYear'},
					{label: '2021',key: 'AThirdYear'},
					{label: '2020',key: 'AFourYear'}
				],
				headers11:[
					{label: '年份',key: 'Type'},
					{label: '分区',key: 'BType1'},
					{label: '2023',key: 'BFirstYear'},
					{label: '2022',key: 'BSecondYear'},
					{label: '2021',key: 'BThirdYear'},
					{label: '2020',key: 'BFourYear'}
				],
				headers12: [
					{label: '年份',key: 'Type'},
					{label: '分区',key: 'CType1'},
					{label: '2023',key: 'CFirstYear'},
					{label: '2022',key: 'CSecondYear'},
					{label: '2021',key: 'CThirdYear'},
					{label: '2020',key: 'CFourYear'}
				],
				
				
				categories4: [],
				seriesData4: [],
				categories5: [],
				seriesData5: [],
				cscjcountActiveName: 'A',
				cscjcountActiveName2: 'A',
				getCountaverCountdetaiLefttableData: [],//初试成绩--第一志愿 a区
				getCountaverCountdetaiLefttableData1: [],//初试成绩--第一志愿 b区
				getCountaverCountdetaiLefttableData2: [],//初试成绩--第一志愿 自划线
				getCountaverCountdetaiLefttableData3: [],//初试成绩--调剂口径 a区
				getCountaverCountdetaiLefttableData4: [],//初试成绩--调剂口径 b区
				getCountaverCountdetaiLefttableData5: [],//初试成绩--调剂口径 自划线
				
				// 初试分数线
				tabs3: ['A区','B区','自划线'],
				averactiveName4: 0,
				csfsxcountActiveName: 'A',
				headers2: [],
				averCountdetaiLefttableData: [],
				categories6:  ['英语', '政治', '专业一', '专业二', '总分'],
				seriesData6: [],
			}
		},
		onLoad(options) {
			this.type = options.type;
			this.code = options.code;
			this.names = options.names;
			this.getData();
		},
		onShow(){},
		methods: {
			async getFirstYear() {
				this.yearOptionsTableInfo = [];
			    await getScoreMajorYears().then((res) => {
			        this.yearOptions = res.data
			        res.data.forEach((item) => {
			            this.yearOptionsTableInfo.push({
			                key: item
			            })
			        });
			    });
			},
			async getData(){
				await this.getFirstYear();
				this.yearValue = ""
				this.yearOptions.forEach((item) => {
				    this.yearValue += item + ","
				})
				
				//获取统一的学科及第一个图标
				this.subjectStat();
				this.getMajorCounts();
				this.listSchoolTypeApplyAndEnrollRate(this.yearValue);
				this.getScoreSection(0,'firstTotal');
				this.listSchoolFirstTotalScoreRateTableData(this.yearValue);
			},
			// 查询专业学科统计-表格
			subjectStat(){
				let info = {
					year: this.yearOptions[0]
				};
				if (this.type == '1') {
				    info.subjectCode = this.code;
				} else if (this.type == '2') {
				    info.subjectOneCode = this.code;
				} else if (this.type == '3') {
					info.majorCode = this.code;
				}
				subjectStat(info).then((res) => {
					console.log('饼图数据：',res);
					let option = {
						majorCode: res.data.code,
						examCode: '',
						direction: '',
						studyType: ''
					} 
					res.data.schoolNumNs = [res.data.schoolNumN,'/pages/toolbox/chooseMajor/school/serchSchool?item='+JSON.stringify({year: 2023,...option})];
					res.data.schoolNumNs1 = [res.data.schoolNumN1,'/pages/toolbox/chooseMajor/school/serchSchool?item='+JSON.stringify({year: 2022,...option})];
					res.data.schoolNumNs2 =[res.data.schoolNumN2,'/pages/toolbox/chooseMajor/school/serchSchool?item='+JSON.stringify({year: 2021,...option})];
					this.schooleTableData = [res.data];
					this.schoolHeader = [
						// {label: '序号',key: },
						{label: '代码',key: 'code'},
						{label: '名称',key: 'name'},
						{label: '23年开设的大学',key: 'schoolNumNs'},
						{label: '22年开设的大学',key: 'schoolNumNs1'},
						{label: '21年开设的大学',key: 'schoolNumNs2'},
					];
					if(this.type == 3){
						this.majorName = res.data.name
					}
				    // this.majorSecondCount = res.data;
				    // this.firstPieTableInfo = [res.data];
				    // this.getPieEcht();
				});
			},
			// 获取专业下pie型图表数据
			async getMajorCounts(){
				var info = {
				    year: new Date().getFullYear()
				};
				if (this.type == 1) {
				    info.subjectCode = this.code;
				} else if (this.type == 2) {
				    info.subjectOneCode = this.code;
				} else if (this.type == 3) {
				    info.majorCode = this.code;
				}
				await getMajorCounts(info).then(res=>{
					console.log('获取专业下pie型图表数据', res);
					let finalData = [];
					res.data.forEach((item) => {
					    item.code = item.subjectOneCode
					    if (this.type == 1) {
					        finalData.push({
					            "name": item.subjectOneName,
					            "value": Number(item.num),
					            "code": item.subjectOneCode,
								"labelShow":false
					        });
					    }
					    if (this.type == 2) {
							console.log('item',item);
					        finalData.push({
					            "name": item.majorName,
					            "value": Number(item.num),
					            "code": item.majorCode,
								"labelShow":true,
								'labelText': item.num
					        });
					    }
					    if (this.type == 3) {
					        //第三级没有
					        finalData = [{
					            "name": `(${this.code})${this.names}`,
					            "value": 100,
					            "code": this.code,
								"labelShow":false
					        }]
					    }
					});
					
					if (finalData.length <= 0) {
					    //3级
					    finalData = [{
					        "name": `(${this.code})${this.names}`,
					        "value": 100,
					        "code": this.code,
							"labelShow":false
					    }]
					}
					this.seriesData7 = finalData;
				})
			},
			
			
			// ===== 报录比 begin =====
			averhandleClick1(tabs1, canvas, width, height){
				if(tabs1 == 0){
					this.listSchoolTypeApplyAndEnrollRate(this.yearValue);
					return;
				}
				this.pageSchoolAreaApplyAndEnrollRate(this.yearValue);
			},
			// 获取专业保录比详情 -- 根据大学类型
			listSchoolTypeApplyAndEnrollRate(yearValue){
				var info = {
					year: yearValue.slice(0, yearValue.length - 1)
				}
				if (this.type == '1') {
				    info.subjectCode = this.code;
				} else if (this.type == '2') {
				    info.subjectOneCode = this.code;
				} else if (this.type == '3') {
				    info.majorCode = this.code;
				}
				listSchoolTypeApplyAndEnrollRate(info).then((res) => {
				    console.info('获取专业保录比详情',res)
					this.setFirstTableInfo(1,res);
				})
			},
			// 获取专业保录比详情-- 根据省份
			pageSchoolAreaApplyAndEnrollRate(yearValue){
				var info = {
				    pageNum: 1,
				    pageSize: 50,
				    year: yearValue.slice(0, yearValue.length - 1)
				};
				if (this.leftTreeIndex == 0) {
				    info.subjectCode = this.treeClickCode;
				} else if (this.leftTreeIndex == 1) {
				    info.subjectOneCode = this.treeClickCode;
				} else if (this.leftTreeIndex == 2) {
				    info.majorCode = this.treeClickCode;
				}
				pageSchoolAreaApplyAndEnrollRate(info).then((res) => {
				    console.info('获取专业保录比详情',res)
					this.setFirstTableInfo(2,res)
				})
			},
			
			setFirstTableInfo(types,res) {
			    var texte11 = [];
			    var texte22 = [];
			    var texte33 = [];
			    var texte44 = [];
			    var texte55 = [];
			    var infoObj = [];
				// "欲招数", "录取数(含专项计划和定向)", "推免数", "调剂数"
				res.data.forEach((item) => {
				    if (item.category == "招生人数") {
				        texte11.push(item)
				    } else if (item.category == "录取人数") {
				        texte22.push(item)
				    } else if (item.category == "保研数") {
				        texte33.push(item)
				    } else if (item.category == "调剂人数") {
				        texte44.push(item)
				    } else if (item.category == "第一志愿") {
				        texte55.push(item)
				    }
				});
				// 表头处理
				this.headers = [];
				for (var i in res.data[0]) {
					if(i=='schoolType' || i == 'n1Year' || i=='n2Year'|| i=='n3Year'|| i=='n4Year'|| i=='category'){
						let keyA = { 
							label: i=='schoolType'?(types==1?'类型':'省份'):i=='n1Year'?'2023':i=='n2Year'?'2022':i=='n3Year'?'2021':i=='n4Year'?'2020':i=='category'?'类别':'', 
							key: i,
						};
						if(i == 'category'){
							this.headers.unshift(keyA)
						}else if(i == 'schoolType'){
							this.headers.unshift(keyA)
						}else{
							this.headers.push(keyA);
						}
					}
				}
				
				this.firstTableData1 = texte11;
				this.firstTableData2 = texte22;
				this.firstTableData3 = texte33;
				this.firstTableData4 = texte44;
				this.firstTableData5 = texte55;
			
				this.seriesData1 = [{
					name: '2023',
					data:  [texte11[0].n1Year=='-'?'':texte11[0].n1Year, texte22[0].n1Year=='-'?'':texte22[0].n1Year, texte33[0].n1Year=='-'?'':texte33[0].n1Year, texte44[0].n1Year=='-'?'':texte44[0].n1Year, texte55[0].n1Year=='-'?'':texte55[0].n1Year],
				},
				{
					name: '2022',
					data: [texte11[0].n2Year=='-'?'':texte11[0].n2Year, texte22[0].n2Year=='-'?'':texte22[0].n2Year, texte33[0].n2Year=='-'?'':texte33[0].n2Year, texte44[0].n2Year=='-'?'':texte44[0].n2Year, texte55[0].n2Year=='-'?'':texte55[0].n2Year],
				},
				{
					name: '2021',
					data: [texte11[0].n3Year=='-'?'':texte11[0].n3Year, texte22[0].n3Year=='-'?'':texte22[0].n3Year, texte33[0].n3Year=='-'?'':texte33[0].n3Year, texte44[0].n3Year=='-'?'':texte44[0].n3Year, texte55[0].n3Year=='-'?'':texte55[0].n3Year],	
				},
				{
					name: '2020',
					data: [texte11[0].n4Year=='-'?'':texte11[0].n4Year, texte22[0].n4Year=='-'?'':texte22[0].n4Year, texte33[0].n4Year=='-'?'':texte33[0].n4Year, texte44[0].n4Year=='-'?'':texte44[0].n4Year, texte55[0].n4Year=='-'?'':texte55[0].n4Year],
				}];
				
			 //    for (let index = 0; index < res.data.length / 5; index++) {
			 //        // Object.assign 实现对象属性的合并
			 //        infoObj[index] = Object.assign(texte11[index], texte22[index], texte55[index], texte33[index],texte44[index]);
			 //    }
			    // return infoObj
			},
			// ===== 报录比 end =====
			
			// ===== 初试成绩 begin =====
			averhandleClick2(tabs2, canvas, width, height){
				console.log(tabs2);
				let sectionType = 'firstTotal';
				if(tabs2==1){
					sectionType = 'firstEnglish';
				}else if(tabs2==2){
					sectionType = 'firstPolitics';
				}else if(tabs2==3){
					sectionType = 'firstMajor1';
				}else if(tabs2==4){
					sectionType = 'firstMajor2';
				}
				this.getScoreSection(1,sectionType)
			},
			averhandleClick3(tabs2, canvas, width, height){
				console.log(tabs2);
				let sectionType = 'firstTotal';
				if(tabs2==1){
					sectionType = 'firstEnglish';
				}else if(tabs2==2){
					sectionType = 'firstPolitics';
				}else if(tabs2==3){
					sectionType = 'firstMajor1';
				}else if(tabs2==4){
					sectionType = 'firstMajor2';
				}
				this.getScoreSection(2,sectionType)
			},
			/**
			 * @param {Object} types 0、调用所有接口，1、调用按第一志愿统计的初试成绩接口，2、调用按调剂口径统计的初试成绩接口，
			 * @param {Object} sectionType 类型参数，firstTotal、初试总分，firstEnglish、英语，firstPolitics、政治，firstMajor1、专一，firstMajor2、专二
			 */
			getScoreSection(types,sectionType){
				let info = {
					year: this.yearOptions[0],
					dataSource: 1,
					sectionType: sectionType,
				};
				if (this.type == '1') {
				    info.subjectCode = this.code;
				} else if (this.type == '2') {
				    info.subjectOneCode = this.code;
				} else if (this.type == '3') {
					info.majorCode = this.code;
				}
				if(types == 0 || types == 1){
					//初试成绩表 以第一志愿口径统计
					getScoreSection(info).then((res) => {
						this.setBottomTableInfo(1,res, "cscj")
					});
				}
				if(types == 0 || types == 2){
					//初试成绩表 以调剂口径统计
					getScoreSection({...info,isAdjust: true}).then((res) => {
						this.setBottomTableInfo(2,res, "cscj")
					});
				}
			},
			setBottomTableInfo(cscjChooseType,res, type) {
			    var texte11 = []
			    var texte22 = []
			    var texte33 = []
			    var texte44 = []
			    var texte55 = []
			    var infoObj = []
			    res.data.forEach((item) => {
			        if (item["分类"] == "A区") {
			            texte11.push({
							AFirstYear: Object.values(item)[2],
							ASecondYear: Object.values(item)[3],
							AThirdYear: Object.values(item)[4],
							AFourYear: Object.values(item)[5],
			                Type: Object.values(item)[1],
							AType1: Object.values(item)[0]
			            })
			        } else if (item["分类"] == "B区") {
			            texte22.push({
			                BFirstYear: Object.values(item)[2],
			                BSecondYear: Object.values(item)[3],
			                BThirdYear: Object.values(item)[4],
			                BFourYear: Object.values(item)[5],
							Type: Object.values(item)[1],
							BType1: Object.values(item)[0]
			            })
			        } else if (item["分类"] == "自划线") {
			            texte33.push({
			                CFirstYear: Object.values(item)[2],
			                CSecondYear: Object.values(item)[3],
			                CThirdYear: Object.values(item)[4],
			                CFourYear: Object.values(item)[5],
							Type: Object.values(item)[1],
							CType1: Object.values(item)[0]
			            })
			        }
			    })
			    for (let index = 0; index < (res.data.length) / 3; index++) {
			        infoObj[index] = Object.assign(texte11[index], texte22[index], texte33[index]);
			    }
			    if (type == "cscj") {
			        if(cscjChooseType == 1){
						// 初试成绩--以第一志愿
						this.getCountaverCountdetaiLefttableData = texte11;
						this.getCountaverCountdetaiLefttableData1 = texte22;
						this.getCountaverCountdetaiLefttableData2 = texte33;
			            this.getCount(1,infoObj, this.getCountactiveName, this.cscjcountActiveName);
						
			        }else{
						// 初试成绩--以调剂口径
						this.getCountaverCountdetaiLefttableData3 = texte11;
						this.getCountaverCountdetaiLefttableData4 = texte22;
						this.getCountaverCountdetaiLefttableData5 = texte33;
			            this.getCount(2,infoObj, this.getCountactiveName2, this.cscjcountActiveName2);
			        }
			    }
			    // return infoObj
			},
			getCount(cscjChooseType,tableInfo, titleWords, areaType) {				
			    var title = ""
			    if (titleWords == "first") {
			        title = "初试总分"
			    } else if (titleWords == "second") {
			        title = "英语"
			    } else if (titleWords == "third") {
			        title = "政治"
			    } else if (titleWords == "four") {
			        title = "专一"
			    } else if (titleWords == "five") {
			        title = "专二"
			    }
			    let cscjcountActiveNames = this.cscjcountActiveName;
			    if (!tableInfo.length) {
			        // tableInfo = tableInfo;
			        if(cscjChooseType == 2){
			            tableInfo = this.getCountaverCountdetaiLefttableData3;
			            cscjcountActiveNames = this.cscjcountActiveName2;
			        }
			    }
			    var first_x_value = [];
			    var second_x_value = [];
			    var third_x_value = [];
			    var four_x_value = [];
			    var titleValue = []
			    var firstValue = []
			    var secondValue = []
			    var thirdValue = []
			    var fourValue = [];
			    tableInfo.forEach((item) => {
			        if (item.Type == '平均分') {
			            if (cscjcountActiveNames == "A") {
			                first_x_value.push(item.AFirstYear=='-'?'':item.AFirstYear);
			                second_x_value.push(item.ASecondYear=='-'?'':item.ASecondYear);
			                third_x_value.push(item.AThirdYear=='-'?'':item.AThirdYear);
			                four_x_value.push(item.AFourYear=='-'?'':item.AFourYear);
			            } else if (cscjcountActiveNames == "B") {
			                first_x_value.push(item.BFirstYear=='-'?'':item.BFirstYear);
			                second_x_value.push(item.BSecondYear=='-'?'':item.BSecondYear);
			                third_x_value.push(item.BThirdYear=='-'?'':item.BThirdYear);
			                four_x_value.push(item.BFourYear=='-'?'':item.BFourYear);
			            } else if (cscjcountActiveNames == "X") {
			                first_x_value.push(item.CFirstYear=='-'?'':item.CFirstYear);
			                second_x_value.push(item.CSecondYear=='-'?'':item.CSecondYear);
			                third_x_value.push(item.CThirdYear=='-'?'':item.CThirdYear);
			                four_x_value.push(item.CFourYear=='-'?'':item.CFourYear);
			            }
			        }
			        if (item.Type == '最低分') {
			            if (cscjcountActiveNames == "A") {
			                first_x_value.push(item.AFirstYear=='-'?'':item.AFirstYear);
			                second_x_value.push(item.ASecondYear=='-'?'':item.ASecondYear);
			                third_x_value.push(item.AThirdYear=='-'?'':item.AThirdYear);
			                four_x_value.push(item.AFourYear=='-'?'':item.AFourYear);
			            } else if (cscjcountActiveNames == "B") {
			                first_x_value.push(item.BFirstYear=='-'?'':item.BFirstYear);
			                second_x_value.push(item.BSecondYear=='-'?'':item.BSecondYear);
			                third_x_value.push(item.BThirdYear=='-'?'':item.BThirdYear);
			                four_x_value.push(item.BFourYear=='-'?'':item.BFourYear);
			            } else if (cscjcountActiveNames == "X") {
			                first_x_value.push(item.CFirstYear=='-'?'':item.CFirstYear);
			                second_x_value.push(item.CSecondYear=='-'?'':item.CSecondYear);
			                third_x_value.push(item.CThirdYear=='-'?'':item.CThirdYear);
			                four_x_value.push(item.CFourYear=='-'?'':item.CFourYear);
			            }
			        }
			        if (item.Type == '最高分') {
			            if (cscjcountActiveNames == "A") {
			                first_x_value.push(item.AFirstYear=='-'?'':item.AFirstYear);
			                second_x_value.push(item.ASecondYear=='-'?'':item.ASecondYear);
			                third_x_value.push(item.AThirdYear=='-'?'':item.AThirdYear);
			                four_x_value.push(item.AFourYear=='-'?'':item.AFourYear);
			            } else if (cscjcountActiveNames == "B") {
			                first_x_value.push(item.BFirstYear=='-'?'':item.BFirstYear);
			                second_x_value.push(item.BSecondYear=='-'?'':item.BSecondYear);
			                third_x_value.push(item.BThirdYear=='-'?'':item.BThirdYear);
			                four_x_value.push(item.BFourYear=='-'?'':item.BFourYear);
			            } else if (cscjcountActiveNames == "X") {
			                first_x_value.push(item.CFirstYear=='-'?'':item.CFirstYear);
			                second_x_value.push(item.CSecondYear=='-'?'':item.CSecondYear);
			                third_x_value.push(item.CThirdYear=='-'?'':item.CThirdYear);
			                four_x_value.push(item.CFourYear=='-'?'':item.CFourYear);
			            }
			        }
			         //新的逻辑操作
			        if (cscjcountActiveNames == "A") {
			            titleValue.push(item.Type)
			            firstValue.push(item.AFirstYear=='-'?'':item.AFirstYear)
			            secondValue.push(item.ASecondYear=='-'?'':item.ASecondYear)
			            thirdValue.push(item.AThirdYear=='-'?'':item.AThirdYear)
			            fourValue.push(item.AFourYear=='-'?'':item.AFourYear)
			        } else if (cscjcountActiveNames == "B") {
			            titleValue.push(item.Type)
			            firstValue.push(item.BFirstYear=='-'?'':item.BFirstYear)
			            secondValue.push(item.BSecondYear=='-'?'':item.BSecondYear)
			            thirdValue.push(item.BThirdYear=='-'?'':item.BThirdYear)
			            fourValue.push(item.BFourYear=='-'?'':item.BFourYear)
			        } else if (cscjcountActiveNames == "X") {
			            titleValue.push(item.Type)
			            firstValue.push(item.CFirstYear=='-'?'':item.CFirstYear)
			            secondValue.push(item.CSecondYear=='-'?'':item.CSecondYear)
			            thirdValue.push(item.CThirdYear=='-'?'':item.CThirdYear)
			            fourValue.push(item.CFourYear=='-'?'':item.CFourYear)
			        }
			    });
				this.getCountEcharts(cscjChooseType,titleValue, firstValue, secondValue, thirdValue, fourValue, first_x_value,second_x_value, third_x_value, four_x_value, title, cscjcountActiveNames);
			},
			getCountEcharts(cscjChooseType,titleValue, firstValue, secondValue, thirdValue, fourValue, first_x_value, second_x_value,third_x_value, four_x_value, title, areaType) {
				firstValue = firstValue.map((item) => {
			        if (item.indexOf("%") > 0) {
			            return item = item.substr(0, item.length - 1)
			        }
			    })
			    secondValue = secondValue.map((item) => {
			        if (item.indexOf("%") > 0) {
			            return item = item.substr(0, item.length - 1)
			        }
			    })
			    thirdValue = thirdValue.map((item) => {
			        if (item.indexOf("%") > 0) {
			            return item = item.substr(0, item.length - 1)
			        }
			    })
			    fourValue = fourValue.map((item) => {
			        if (item.indexOf("%") > 0) {
			            return item = item.substr(0, item.length - 1)
			        }
			    })
			    var toptitle = titleValue.slice(0, titleValue.length - 3);
			    var topfirst = firstValue.slice(0, firstValue.length - 3);
			    var topsecond = secondValue.slice(0, secondValue.length - 3);
			    var topthree = thirdValue.slice(0, thirdValue.length - 3);
			    var topfour = fourValue.slice(0, fourValue.length - 3);
			
			    //下面图表的数据
			    var bottomtitle = titleValue.slice(-3);
			    var typeName = ""
			    if (areaType == "A") {
			        typeName = "A区"
			    } else if (areaType == "B") {
			        typeName = "B区"
			    } else if (areaType == "X") {
			        typeName = "自划线"
			    }

				
			    if(cscjChooseType == 1){
					this.categories2 = toptitle;
					this.seriesData2 =[
						{name: this.yearOptions[0],data: topfirst,format: 'yAxisDemo3'},
						{name: this.yearOptions[1],data: topsecond,format: 'yAxisDemo3'},
						{name: this.yearOptions[2],data: topthree,format: 'yAxisDemo3'},
						{name: this.yearOptions[3],data: topfour,format: 'yAxisDemo3'},
					];
					this.categories3 = bottomtitle;
					this.seriesData3 =[
						{name: this.yearOptions[0],data: first_x_value},
						{name: this.yearOptions[1],data: second_x_value},
						{name: this.yearOptions[2],data: third_x_value},
						{name: this.yearOptions[3],data: four_x_value},
					];
			    }else{
					this.categories4 = toptitle;
					this.seriesData4 =[
						{name: this.yearOptions[0],data: topfirst,format: 'yAxisDemo3'},
						{name: this.yearOptions[1],data: topsecond,format: 'yAxisDemo3'},
						{name: this.yearOptions[2],data: topthree,format: 'yAxisDemo3'},
						{name: this.yearOptions[3],data: topfour,format: 'yAxisDemo3'},
					];
					this.categories5 = bottomtitle;
					this.seriesData5 =[
						{name: this.yearOptions[0],data: first_x_value},
						{name: this.yearOptions[1],data: second_x_value},
						{name: this.yearOptions[2],data: third_x_value},
						{name: this.yearOptions[3],data: four_x_value},
					];
			    }
				
			},
			// ===== 初试成绩 end =====
			
			// ===== 初试分数线 begin =====
			averhandleClick4(tabs3, canvas, width, height){
				console.log(tabs3);
				if(tabs3 == 0){
					this.csfsxcountActiveName = 'A';
				}else if(tabs3 == 1){
					this.csfsxcountActiveName = 'B';
				}else{
					this.csfsxcountActiveName = 'X';
				}
				this.listSchoolFirstTotalScoreRateTableData(this.yearValue);
			},
			// 初试分数线对应旁边表格的数据
			listSchoolFirstTotalScoreRateTableData(yearValue){
				let info = {
					subjectCode: '',
					majorCode: '',
					subjectOneCode: '',
					pageNum: 1,
					pageSize: 100,
					schoolCode: '', //学校code
					collegeCode: '',//学院code
					year: yearValue.slice(0, yearValue.length - 1),
					schoolType: this.csfsxcountActiveName
				}
				if (this.type == '1') {
				    info.subjectCode = this.code;
				} else if (this.type == '2') {
				    info.subjectOneCode = this.code;
				} else if (this.type == '3') {
					info.majorCode = this.code;
				}
				
				//初试分数线新的表格接口
				listSchoolFirstTotalScoreRateTableData(info).then((res) => {
					console.log('初试分数线',res);
				    this.averCountdetaiLefttableData = res.data;
					this.headers2=[];
					for (var i in res.data[0]) {
						if(i=='type' || i == 'n1Year' || i=='n2Year'|| i=='n3Year'|| i=='n4Year'){
							let keyA = { label: i=='type'?'分类':i=='n1Year'?'2023':i=='n2Year'?'2022':i=='n3Year'?'2021':i=='n4Year'?'2020':'', key: i};
							if(i == 'type'){
								this.headers2.unshift(keyA)
							}else{
								this.headers2.push(keyA);
							}
						}
					}
					
				    //初试分数线f
				    this.getaverCount();
				    // this.pjfTotalInfoList = res.data;
				});
			},
			
			getaverCount() {
			    // var textInfo = [];
			    var firstCountInfo = [];
			    var secondCountInfo = [];
			    var thirdCountInfo = [];
			    var fourCountInfo = [];
			    firstCountInfo.push(
					this.averCountdetaiLefttableData[1].n1Year=='-'?'':this.averCountdetaiLefttableData[1].n1Year, 
					this.averCountdetaiLefttableData[2].n1Year=='-'?'':this.averCountdetaiLefttableData[2].n1Year, 
					this.averCountdetaiLefttableData[3].n1Year=='-'?'':this.averCountdetaiLefttableData[3].n1Year, 
					this.averCountdetaiLefttableData[4].n1Year=='-'?'':this.averCountdetaiLefttableData[4].n1Year,
			        this.averCountdetaiLefttableData[0].n1Year=='-'?'':this.averCountdetaiLefttableData[0].n1Year)
			
			    secondCountInfo.push(
					this.averCountdetaiLefttableData[1].n2Year=='-'?'':this.averCountdetaiLefttableData[1].n2Year, 
					this.averCountdetaiLefttableData[2].n2Year=='-'?'':this.averCountdetaiLefttableData[2].n2Year,
					this.averCountdetaiLefttableData[3].n2Year=='-'?'':this.averCountdetaiLefttableData[3].n2Year,
					this.averCountdetaiLefttableData[4].n2Year=='-'?'':this.averCountdetaiLefttableData[4].n2Year,
			        this.averCountdetaiLefttableData[0].n2Year=='-'?'':this.averCountdetaiLefttableData[0].n2Year)
			
			    thirdCountInfo.push(
					this.averCountdetaiLefttableData[1].n3Year=='-'?'':this.averCountdetaiLefttableData[1].n3Year, 
					this.averCountdetaiLefttableData[2].n3Year=='-'?'':this.averCountdetaiLefttableData[2].n3Year,
					this.averCountdetaiLefttableData[3].n3Year=='-'?'':this.averCountdetaiLefttableData[3].n2Year,
					this.averCountdetaiLefttableData[4].n3Year=='-'?'':this.averCountdetaiLefttableData[4].n3Year,
			        this.averCountdetaiLefttableData[0].n3Year=='-'?'':this.averCountdetaiLefttableData[0].n3Year)
			
			    fourCountInfo.push(
					this.averCountdetaiLefttableData[1].n4Year=='-'?'':this.averCountdetaiLefttableData[1].n4Year,
					this.averCountdetaiLefttableData[2].n4Year=='-'?'':this.averCountdetaiLefttableData[2].n4Year,
					this.averCountdetaiLefttableData[3].n4Year=='-'?'':this.averCountdetaiLefttableData[3].n4Year,
					this.averCountdetaiLefttableData[4].n4Year=='-'?'':this.averCountdetaiLefttableData[4].n4Year,
			        this.averCountdetaiLefttableData[0].n4Year=='-'?'':this.averCountdetaiLefttableData[0].n4Year)
			   
				var title = ""
				if (this.csfsxcountActiveName == "A") {
				    title = "A区"
				} else if (this.csfsxcountActiveName == "B") {
				    title = "B区"
				} else if (this.csfsxcountActiveName == "X") {
				    title = "自划线"
				}
				this.seriesData6 = [
					{name: this.yearOptions[0],data: firstCountInfo},
					{name: this.yearOptions[1],data: secondCountInfo},
					{name: this.yearOptions[2],data: thirdCountInfo},
					{name: this.yearOptions[3],data: fourCountInfo},
				]
				
				
			},
			// ===== 初试分数线 end =====
		},
	}
</script>

<style lang="scss" scoped>
	.summarize{
		background: #f2f2f2;
		height: 100%;
		min-height: 100vh;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		
		.little_words {
			text-align: center;
			font-size: 32rpx;
			font-weight: 550;
			margin-bottom: 48rpx;
			line-height: 1rem;
			margin: 44rpx 0 20rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			
			image{
				width:32rpx;
				height: 32rpx;
				margin-right: 12rpx;
			}
			
		}
		
		.rightInfoBox {
			// width: 85%;
			border: 1px solid #E0E0E0;
			padding-left: 40rpx;
			padding-right: 40rpx;
			margin: 0 30rpx;
			margin-bottom: 40rpx;
			// margin-top: 30rpx;
			background: #ffffff;
			
			
			
			.firstTop {
				display: flex;
				align-items: flex-end;
				margin-top: 16rpx;
				
			}
			
			.firstTopWords {
				font-style: italic;
				color: #aaaaaa;
				font-size: 28rpx;
				font-weight: 700;
				// margin-left: 10px;
				// margin-top: 15px;
			}
			
			.lineBox {
			
				height: 6px;
				width: 98%;
				border-radius: 10px;
				background-color: #d7d7d7;
			}
			
			.smallSize {
				font-size: 24rpx;
				line-height: 36rpx;
				color: #333333;
				
			}
			
			.middleBox {
				margin: 26rpx 0;
			}
			
			
			.weightFont {
				// color: black;
				color: #333333;
				font-size: 24rpx;
				line-height: 36rpx;
				font-weight: 400;
				font-style: italic;
				letter-spacing: normal;
			}
			
			.echarts-wrap {
				width: 100%;
				height: 300px;
			}
			
			.content {
				background-color: #EBEEEF;
				width: 100%;
				height: 100%;
				min-height: 100vh;
				// padding-top: 20rpx;
				padding-bottom: 20rpx;
			}
			
			
			
		}
		.firstEchartBox {
			height: 300px;
			margin: 0 30rpx;
			// width: 96.7%;
			position: relative;
			// 只改了这一个地方
			background-color: #fff;
			// background-color: #081736;
			margin-bottom: 32rpx;
			
			// z-index: -1;
		}
		
		.cscjTableBox,.fscjTableBox,.cxsfxTableBox,.cjzkTableBox,.firstTableBox{
			margin: 0 30rpx;
		}
		
	}
</style>